package com.artpri.dao.impl;

import org.hibernate.transform.Transformers;

import com.artpri.dao.RecGoodsDao;
import com.artpri.model.vo.RecGoods;

/**
 * 
 * @author ZhangSi
 *
 */
public class RecGoodsDaoImpl extends HibernateDaoImpl<RecGoods> implements RecGoodsDao{
	@Override
	public RecGoods get(Integer goodsNum) {
		String sql = "select g.goods_num goodsNum, g.goods_name goodsName, u.user_num userNum, u.user_name userName, s.shopkeeper_num shopkeeperNum, s.sk_name skName, a.ga_path gaPath"
				+ " from goods g, user_info u, goods_album a, shopkeeper_info s"
				+ " where g.goods_num=" + goodsNum
				+ " and g.user_num=u.user_num"
				+ " and g.shopkeeper_num=s.shopkeeper_num"
				+ " and g.goods_num=a.goods_num"
				+ " and a.ga_main=1";
		
		return (RecGoods) getSqlQuery(sql).setResultTransformer(Transformers.aliasToBean(RecGoods.class)).uniqueResult();
	}
}
